package net.cyndeline.GUI.graphics

import javafx.scene.image.{Image, ImageView}
import net.cyndeline.GUI.setup.AnimationType

/**
 * Defines methods which can be invoked to change the appearance of an entity by triggering animations.
 */
trait Representation {

  /** The x pixel coordinate this representation should be drawn at. */
  def x: Int

  /** The y pixel coordinate this representation should be drawn at. */
  def y: Int

  /** Sets a new x pixel coordinate. */
  def x_=(newX: Int)

  /** Sets a new y pixel coordinate. */
  def y_=(newY: Int)

  /** Retrieves the current sprite representation of this entity. */
  def getView: Image

  /** Activates an animation of a specified type, or defaults to an animation if the type isn't found. */
  def switchToAnimation(animation: AnimationType)

  /** Should be called every frame to advance the animation (if any) of this representation. */
  def process()

  /** Height in pixels of each animation frame. */
  def height: Int

  /** Width in pixels of each animation frame. */
  def width: Int

}
